package com.wc.codeforces.排序.Balanced_Shuffle;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/6/8 11:06
 * @description https://codeforces.com/problemset/problem/1970/A1
 */
public class Main {
    /**
     * 细节：要char是有范围的
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 500010;
    static int[][] s = new int[N][3];
    static int n;

    public static void main(String[] args) {
        char[] origin = sc.next().toCharArray();
        n = origin.length;
        int l = 0, r = 0;
        for (int i = 0; i < n; i++) {
            s[i][0] = origin[i];
            s[i][1] = (l - r);
            s[i][2] = i;
            if (origin[i] == '(') l++;
            else r++;
        }
        Arrays.sort(s, 0, n, ((o1, o2) -> {
            if (o1[1] == o2[1]) return o2[2] - o1[2];
            else return o1[1] - o2[1];
        }));
        for (int i = 0; i < n; i++) out.print((char) s[i][0]);
        out.println();
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
